<?php

namespace common\models\rbac;

use Yii;

/**
 * This is the model class for table "{{%rbac_department}}".
 *
 * @property int $id
 * @property int $project_id 所属项目ID
 * @property int $pid 父ID【0顶级、>0部门id】
 * @property int $level 层级
 * @property string $name 部门名称
 * @property string $department_leader 负责人姓名【','分割】
 * @property int $total_num 部门总人数
 * @property int $status 状态【-1删除、0禁用、1启用】
 * @property string $remark 备注
 * @property int $sort 排序
 * @property int $created_at 添加时间
 * @property int $updated_at 更新时间
 */
class Department extends \common\models\BaseModel
{
    const STATUS_DELETE = -1;// 删除
    const STATUS_DISABLE = 0;// 停用
    const STATUS_ENABLE = 1;// 启用

    const NAME_INFUSION = '输液室';// 输液大厅部门名称

    public static $statuss = [
        self::STATUS_DELETE => '删除',
        self::STATUS_DISABLE => '停用',
        self::STATUS_ENABLE => '启用',
    ];

    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%rbac_department}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['project_id', 'pid', 'level', 'total_num', 'status', 'sort', 'created_at', 'updated_at'], 'integer'],
            [['name'], 'string', 'max' => 32],
            [['department_leader'], 'string', 'max' => 200],
            [['remark'], 'string', 'max' => 100],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'project_id' => '所属项目ID',
            'pid' => '父ID【0顶级、>0部门id】',
            'level' => '层级',
            'name' => '部门名称',
            'department_leader' => '负责人姓名【','分割】',
            'total_num' => '部门总人数',
            'status' => '状态【-1删除、0禁用、1启用】',
            'remark' => '备注',
            'sort' => '排序',
            'created_at' => '添加时间',
            'updated_at' => '更新时间',
        ];
    }
}
